﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;
using qiupeng.Public;
using System.IO;

public partial class main : Base
{
    public static string showpost, showrealname, txtime, iftx, Sound, showtime,staffid;
    Db List = new Db();
    protected void Page_Load(object sender, EventArgs e)
    {
        //Session["username"] = "admin";
        //Session["realname"] = "管理员";
        staffid = Session["StaffId"].ToString();

        this.ImageButton1.Attributes.Add("onclick", "javascript:return zx();");

        string SQL_GetList_key = "select * from qp_hr_FjKey ";
        OleDbDataReader NewReader_key = List.GetList(SQL_GetList_key);
        if (NewReader_key.Read())
        {
            this.Session["FjKey"] = NewReader_key["content"];

        }
        NewReader_key.Close();//附件类型




        string SQL_GetListus = "select * from qp_hr_username where username='" + Session["username"] + "'";
        OleDbDataReader NewReaderUs = List.GetList(SQL_GetListus);
        if (NewReaderUs.Read())
        {
            this.Session["perstr"] = NewReaderUs["ResponQx"];
            this.Session["GzdwId"] = NewReaderUs["BuMenId"];
            this.Session["GzdwName"] = NewReaderUs["BuMen"];

            this.Session["Respon"] = NewReaderUs["Respon"];
            this.Session["ResponId"] = NewReaderUs["ResponId"];


        }
        NewReaderUs.Close();//用户参数


        string SQL_GetListtar1 = "select * from qp_hr_Respon where id='" + Session["ResponId"] + "'";
        OleDbDataReader NewReaderTar1 = List.GetList(SQL_GetListtar1);
        if (NewReaderTar1.Read())
        {
            this.Session["BmQx"] = NewReaderTar1["BmQx"];

        }
        NewReaderTar1.Close();//部门数据权限


        //string SQL_GetCount = "select count(id) from  qp_hr_username";
        //int CountsUser = List.GetCount(SQL_GetCount);
        //if (CountsUser > 10)
        //{
        //    Response.Write("<script>alert('试用版，软件使用人数限制为10人！请联系开发商！');window.location.href='Default.aspx'</Script>");
        //    return;
        //}//试用版，软件使用人数受到限制！请联系开发商


        //TimeSpan sp = DateTime.Parse(DateTime.Now.ToShortDateString()) - DateTime.Parse("2008-9-1");
        //if (sp.TotalDays > 0)
        //{

        //    Response.Write("<script>alert('您的版本已经过期！');window.location.href='Default.aspx'</Script>");
        //    return;
        //}//试用版过期设置

        showtime = "" + System.DateTime.Now.Year.ToString() + "年" + System.DateTime.Now.Month.ToString() + "月" + System.DateTime.Now.Day.ToString() + "日";
        showrealname = this.Session["realname"].ToString();


        //string SQL_GetList_key = "select * from qp_KeyStr where KeyStr='C4CA4238A0B923820DCC509A6F75849B'";
        //OleDbDataReader NewReader_key = List.GetList(SQL_GetList_key);
        //if (NewReader_key.Read())//MD5密码是否正确
        //{
        //Label2.Text = "河南煤化鹤煤集团安全档案管理系统&nbsp;&nbsp;&nbsp;QQ：770504810、16927129&nbsp;&nbsp;&nbsp;&nbsp;使用单位：中国有限公司公司&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;版本号：V3.0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;使用期限[<a href=\"javascript:void(0) \"  onclick=\"keystr()\">" + System.DateTime.Parse(NewReader_key["InsetTime"].ToString()).AddDays(double.Parse(NewReader_key["Name"].ToString())).ToShortDateString() + "</a>]";
        //}
        //else
        //{
        //    Response.Write("<script>alert('您的版本错误！请联系开发商！');window.location.href='Default.aspx'</Script>");
        //    return;
        //}





    }

    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        List.InsertLog("注销系统", "注销系统");
        Session.Clear();
        Response.Redirect("Default.aspx");
    }
}
